<?php

declare(strict_types=1);

namespace App\Controller\Client;


use App\Controller\AbstractController;
use App\Request\Client\Certification\CompanyRequest;
use App\Request\Client\Certification\IdcardRequest;
use App\Service\Client\CertificationService;
use Hyperf\Di\Annotation\Inject;

class CertificationController extends AbstractController
{
    /**
     * @Inject()
     * @var CertificationService
     */
    protected $certificationService;

    public function idcardInfo(){
        $data = $this->certificationService->idcardInfo();
        return $this->response->success($data);
    }

    /**
     * 实名认证-个人
     * @param IdcardRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function idcard(IdcardRequest $request)
    {
        $validator = $request->validated();
        $this->certificationService->idcard($validator);
        return $this->response->success();
    }

    public function companyInfo(){
        $data = $this->certificationService->companyInfo();
        return $this->response->success($data);
    }

    /**
     * 实名认证-公司
     * @param CompanyRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function company(CompanyRequest $request)
    {
        $validator = $request->validated();
        $this->certificationService->company($validator);
        return $this->response->success();
    }


}